#pragma once

#define HEIGHT  9
#define WIDTH   9

namespace xAlgorithm
{
    class _position
    {
    public:
        _position();
        _position(int x, int y);

        bool operator == (const _position& other) const;
        bool operator < (const _position& other) const;

        int m_x;
        int m_y;
    };

    typedef _position POS, *LPPOS;


    class _node_info
    {
    public:
        _node_info();

        POS         pos;
        int         g;
        int         h;
        POS         parent;
    };

    typedef _node_info NODEINFO, *LPNODEINFO;

    class CAStar
    {
        typedef std::map<POS, NODEINFO>                 POSNODE;
        typedef std::map<int, std::vector<NODEINFO>>    INTNODE;
    public:
        CAStar();
        ~CAStar();

        bool FindPath(const POS& start, const POS& end, std::vector<POS>& path);

    private:
        int     m_Map[HEIGHT][WIDTH];
    };
};
